<template>
  <div class="assemble">
    <header>
      <div class="assemble_header">
        <img src="../../assets/img/zuojiantou.png" alt="" @click="back">
        拼团优惠
      </div>
      <!--   拼团分类   -->
<!--      <div class="assembleList">-->
<!--        <div class="abList_box" v-for="(x,y) in assembleList" @click="isType(y)">-->
<!--          <p>{{x.name}}</p>-->
<!--          <transition name="el-zoom-in-center">-->
<!--            <p v-show="present == y"></p>-->
<!--          </transition>-->
<!--        </div>-->
<!--      </div>-->
    </header>

    <van-pull-refresh
      v-model="isLoading"
      success-text="刷新成功"
      @refresh="onRefresh"
    >
      <all :id="type_id"></all>
      <router-view></router-view>
    </van-pull-refresh>

  </div>
</template>

<script>
  import all from "../../components/ClientComponents/assemble/all";
  export default {
    name: "assemble",
    components:{
      all
    },
    data() {
      return {
        type_id:0,
        assembleList: [],
        present: 0,
        isLoading: false,
      }
    },
    created(){
        this.$myAxios('api/group/all_type', 'get', {},0).then(res => {
            if(res.data.state == 1){
                console.log(res.data.data);
                this.assembleList = res.data.data;
                this.$myAxios('/api/group/type_list', 'get', {
                    type_id:0 //全部的商品
                },0).then(res => {

                })
            }else{
                this.$myNotice(res.data.msg,2000);
            }
        })
    },
    methods: {
      back() {
        this.$router.back();
      },
      onRefresh() {
        setTimeout(() => {
          this.$toast('刷新成功');
          this.isLoading = false;
        }, 1000);
      },
      isType(index){
        this.present = index;
        this.type_id = this.assembleList[index].id
      },

    },
    mounted() {

    }
  }
</script>

<style scoped>
  .assemble {
    /*padding-top: .8rem;*/
    padding-top: .48rem;
  }

  .assemble header {
    width: 100%;
    position: fixed;
    top: -.01rem;
    left: 0;
    z-index: 999;
    /*height: .81rem;*/
    height: .5rem;
    background-image: url("../../../static/img/pt_juxing.png");
    background-size: 100% 120%;
    color: #ffffff;
    text-align: center;
  }

  .assemble_header {
    height: .5rem;
    width: 100%;
    position: relative;
    line-height: .5rem;
    font-size: .18rem;
  }

  .assemble_header img {
    width: .10rem;
    height: .18rem;
    position: absolute;
    left: .13rem;
    top: calc(50% - .09rem);
  }

  /* 拼团分类部分 */
  .assembleList {
    width: 100%;
    height: 100%;
    max-height: .3rem;
    display: flex;
    flex-flow: row;
    align-items: center;
    overflow-y: hidden;
    overflow-x: scroll;
    display: -webkit-box;
  }
  .assembleList::-webkit-scrollbar {
    display: none;
  }
  .abList_box {
    height: 100%;
    max-height: .3rem;
    padding: 0 .15rem .05rem;
    display: flex;
    flex-flow: column;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
  }

  .abList_box > p:nth-child(1) {
    color: #FFFEFE;
    font-size: .15rem;
  }

  .abList_box > p:nth-child(2) {
    width: .18rem;
    height: .02rem;
    background-color: #ffffff;
    border-radius: .01rem;
  }


  .el-loading-spinner {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    min-height: 5rem;
  }

</style>
